﻿<%@ Page Title="" Language="C#" MasterPageFile="~/UI/Main/Main.Master" AutoEventWireup="true"
    CodeBehind="CreateGroup.aspx.cs" Inherits="OrganizedIN.UI.GroupContact.CreateGroup" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script src="../../src/js/jquery.fcbkcomplete.js" type="text/javascript"></script>
    <table style="width: 90%">
        <tbody>
            <tr>
                <td align="center" colspan="2" style="background-color: #6D84B4; color: #FFFFFF;
                    font-weight: bold; font-family: arial, Helvetica, sans-serif; font-size: medium;">
                    Create Group
                </td>
            </tr>
            <tr>
                <td class="style1" style="width: 25%" width="150">
                    Group Name
                </td>
                <td style="text-align: left">
                    <asp:TextBox ID="txtgrpname" runat="server" Width="90%"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtgrpname"
                        Display="Dynamic" ErrorMessage="*" ForeColor="#FF0066" ValidationGroup="add"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style1" style="width: 25%" width="150">
                    &nbsp;
                </td>
                <td style="text-align: left">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style1" style="width: 25%">
                    <asp:Label ID="lblprivacy" runat="server" Text="Privacy"></asp:Label>
                </td>
                <td align="left">
                    <asp:DropDownList ID="ddlprivacy" runat="server">
                        <asp:ListItem>-Select-</asp:ListItem>
                        <asp:ListItem>Open</asp:ListItem>
                        <asp:ListItem>Closed</asp:ListItem>
                        <asp:ListItem>Secret</asp:ListItem>
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddlprivacy"
                        Display="Dynamic" ErrorMessage="*" ForeColor="#FF0066" InitialValue="-Select-"
                        ValidationGroup="add"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style1" style="width: 25%">
                    &nbsp;
                </td>
                <td align="left">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style1" style="width: 25%">
                    <asp:Label ID="lblprivacy0" runat="server" Text="Members"></asp:Label>
                    <span id="nocontacts" style="color: Red; display: none">* Please Add Contacts</span>
                </td>
                <td align="left">
                    <input type="text" id="Friends" title="1" />
                    <input type="hidden" id="hdnSelected" runat="server" />
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center">
                    <asp:Button ID="btnregister" runat="server" OnClick="btnregister_Click" OnClientClick="checkContacts();"
                        Text="Register" ValidationGroup="add" />
                    &nbsp;&nbsp;
                    <asp:Button ID="btnCancel" runat="server" OnClick="btnCancel_Click1" Text="Cancel" />
                </td>
            </tr>
        </tbody>
    </table>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#Friends").fcbkcomplete({
                json_url: '<%=ResolveClientUrl("~/UI/ContactSuggest.ashx") %>',
                addontab: false,
                height: 2,
                complete_text: "Start Typing Contact Names...",
                onremove: "Remove",
                onselect: "Add"
            });
        });

        function Add(item,gid) {
            if ($("[id$=hdnSelected]").val().indexOf(item._value) == -1)
                $("[id$=hdnSelected]").val($("[id$=hdnSelected]").val() + item._value + "||");
        }

        function Remove(item,gid) {
            $("[id$=hdnSelected]").val($("[id$=hdnSelected]").val().replace(item._value + "||",""));
        }

    </script>
</asp:Content>
